<section class="header clearfix">
  <h1 class="pull-left text-capitalize">{{t headerLabel}}</h1>
</section>

<div class="banner bg-info">
  <div class="banner-icon p-20"><i class="icon icon-info"></i></div>
  <div class="banner-message p-20">
    {{#if isClusterLevel}}
      {{t "loggingPage.helpText.cluster" htmlSafe=true}}
    {{else}}
      <ul>
        <li style="list-style: circle;"> {{t "loggingPage.helpText.cluster" htmlSafe=true}} </li>
        <li style="list-style: circle;">
          {{#if (and clusterTargetType (not-eq clusterTargetType "none"))}}
            {{t "loggingPage.helpText.clusterTarget" clusterTargetType=clusterTargetType htmlSafe=true}}
          {{else}}
            {{t "loggingPage.helpText.noClusterTarget"}}
          {{/if}}
        </li>
      </ul>
    {{/if}}
  </div>
</div>

{{#if (not-eq targetType "none")}}
  <section class="header has-tabs clearfix p-0">
    <ul class="tab-nav">
      {{#if (eq targetType "customTarget")}}
        <li>
          <button class={{concat (if testing "btn-disabled-transparent") " btn bg-transparent"}} {{action "cancel"}} disabled={{testing}}>{{t "loggingPage.advanced.cancel"}}</button>
        </li>
      {{else}}
        <li>
          <button class="btn bg-transparent" {{action "showPaste"}}>{{t "loggingPage.advanced.file"}} <span class="icon icon-copy"></span></button>
        </li>
      {{/if}}
    </ul>
  </section>
{{/if}}

{{#if (eq targetType "customTarget")}}
  <div class="mt-25">
    {{logging/input-logging-config
        showDownload=false
        canChangeName=false
        autoResize=true
        value=customContent
        model=model.customTarget
        parentModel=model
        targetType=targetType
        pageScope=pageScope
    }}
  </div>
  {{copy-to-clipboard
      tooltipText=""
      buttonText="copyToClipboard.tooltip"
      clipboardText=value
      class="with-clip"
  }}
{{else}}
  {{logging/targets-nav
      originalModel=originalModel
      targetType=targetType
      isClusterLevel=isClusterLevel
      pageScope=pageScope
  }}

  {{#if (and originalModel.showTransitioningMessage (eq originalModel.targetType targetType))}}
    <div class="banner {{originalModel.stateBackground}}">
      <div class="banner-icon p-20"><i class="icon {{originalModel.stateIcon}}"></i></div>
      <div class="banner-message p-20">
        <table>
          {{error-sub-row fullColspan=fullColspan model=originalModel}}
        </table>
      </div>
    </div>
  {{/if}}

  {{#if (eq targetType "elasticsearch")}}
    {{logging/target-elasticsearch
         targetType=targetType
         model=model.elasticsearch
         pageScope=pageScope
         parentModel=model
         endpointErrorText=esErrors
    }}
  {{else if (eq targetType "splunk")}}
    {{logging/target-splunk
        model=model.splunk
        parentModel=model
        targetType=targetType
    }}
  {{else if (eq targetType "kafka")}}
    {{logging/target-kafka
        model=model.kafka
        parentModel=model
        targetType=targetType
    }}
  {{else if (eq targetType "syslog")}}
    {{logging/target-syslog
        model=model.syslog
        parentModel=model
        targetType=targetType
    }}
  {{else if (eq targetType "fluentForwarder")}}
    {{logging/target-flentd
        model=model.fluentForwarder
        parentModel=model
        targetType=targetType
        endpointValidate=endpointValidate
    }}
  {{/if}}
{{/if}}

{{top-errors errors=errors}}

{{#if (not-eq targetType "none")}}
  {{logging/form-test
      test=(action "test")
      testing=testing
      tested=tested
      testOk=testOk
      model=model
      targetType=targetType
  }}
{{/if}}

<div class="footer-actions">
  {{save-cancel
      saveDisabled=saveDisabled
      cancelDisabled=true
      editing=true
      save="save"
  }}
</div>
